package com.hello.system.service.impl;

import java.util.List;
import com.hello.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hello.system.mapper.TopicArticlesMapper;
import com.hello.system.domain.TopicArticles;
import com.hello.system.service.ITopicArticlesService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 专题文章Service业务层处理
 * 
 * @author hello
 * @date 2025-05-30
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class TopicArticlesServiceImpl extends ServiceImpl<TopicArticlesMapper, TopicArticles> implements ITopicArticlesService 
{
    private final TopicArticlesMapper topicArticlesMapper;

    /**
     * 查询专题文章
     * 
     * @param articleId 专题文章主键
     * @return 专题文章
     */
    @Override
    public TopicArticles selectTopicArticlesByArticleId(Long articleId)
    {
        return topicArticlesMapper.selectTopicArticlesByArticleId(articleId);
    }

    /**
     * 查询专题文章列表
     * 
     * @param topicArticles 专题文章
     * @return 专题文章
     */
    @Override
    public List<TopicArticles> selectTopicArticlesList(TopicArticles topicArticles)
    {
        return topicArticlesMapper.selectTopicArticlesList(topicArticles);
    }

    /**
     * 新增专题文章
     * 
     * @param topicArticles 专题文章
     * @return 结果
     */
    @Override
    public int insertTopicArticles(TopicArticles topicArticles)
    {
        topicArticles.setCreateTime(DateUtils.getNowDate());
        return topicArticlesMapper.insertTopicArticles(topicArticles);
    }

    /**
     * 修改专题文章
     * 
     * @param topicArticles 专题文章
     * @return 结果
     */
    @Override
    public int updateTopicArticles(TopicArticles topicArticles)
    {
        topicArticles.setUpdateTime(DateUtils.getNowDate());
        return topicArticlesMapper.updateTopicArticles(topicArticles);
    }


    /**
     * 批量删除专题文章
     * 
     * @param articleIds 需要删除的专题文章主键
     * @return 结果
     */
    @Override
    public int deleteTopicArticlesByArticleIds(Long[] articleIds)
    {
        return topicArticlesMapper.deleteTopicArticlesByArticleIds(articleIds);
    }

    /**
     * 删除专题文章信息
     * 
     * @param articleId 专题文章主键
     * @return 结果
     */
    @Override
    public int deleteTopicArticlesByArticleId(Long articleId)
    {
        return topicArticlesMapper.deleteTopicArticlesByArticleId(articleId);
    }
}
